<template>
  <div class="home">
    <div class="hero-section">
      <div class="hero-content">
        <h1 class="hero-title">欢迎使用在线考试与题库系统</h1>
        <p class="hero-subtitle">这是一个现代化的教育管理平台，为学校提供完整的用户管理和权限控制功能</p>
        <div class="hero-buttons">
          <el-button 
            type="primary" 
            size="large"
            @click="$router.push('/login')" 
            v-if="!isAuthenticated"
            class="hero-btn"
          >
            <el-icon><User /></el-icon>
            立即登录
          </el-button>
          <el-button 
            type="success" 
            size="large"
            @click="$router.push('/dashboard')" 
            v-if="isAuthenticated"
            class="hero-btn"
          >
            <el-icon><Monitor /></el-icon>
            进入仪表板
          </el-button>
        </div>
      </div>
      <div class="hero-image">
        <div class="floating-cards">
          <div class="card card-1">
            <el-icon><User /></el-icon>
            <span>学生管理</span>
          </div>
          <div class="card card-2">
            <el-icon><School /></el-icon>
            <span>教师管理</span>
          </div>
          <div class="card card-3">
            <el-icon><Setting /></el-icon>
            <span>系统管理</span>
          </div>
        </div>
      </div>
    </div>
    
    <div class="features-section">
      <h2 class="section-title">系统特色</h2>
      <div class="features-grid">
        <div class="feature-card">
          <div class="feature-icon">
            <el-icon><Shield /></el-icon>
          </div>
          <h3>安全可靠</h3>
          <p>采用先进的加密技术，确保用户数据安全</p>
        </div>
        <div class="feature-card">
          <div class="feature-icon">
            <el-icon><Monitor /></el-icon>
          </div>
          <h3>实时监控</h3>
          <p>实时监控系统状态，及时发现问题</p>
        </div>
        <div class="feature-card">
          <div class="feature-icon">
            <el-icon><DataAnalysis /></el-icon>
          </div>
          <h3>数据分析</h3>
          <p>强大的数据分析功能，助力决策</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { computed } from 'vue'
import { useStore } from 'vuex'
import { User, School, Setting, Monitor, DataAnalysis } from '@element-plus/icons-vue'

export default {
  name: 'Home',
  components: {
    User,
    School,
    Setting,
    Monitor,
    DataAnalysis
  },
  setup() {
    const store = useStore()
    const isAuthenticated = computed(() => store.getters.isAuthenticated)
    
    return {
      isAuthenticated
    }
  }
}
</script>

<style scoped>
.home {
  min-height: 100vh;
}

.hero-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 80px 120px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  min-height: 70vh;
}

.hero-content {
  flex: 1;
  max-width: 600px;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.3rem;
  margin-bottom: 40px;
  opacity: 0.9;
  line-height: 1.6;
}

.hero-buttons {
  display: flex;
  gap: 20px;
}

.hero-btn {
  padding: 15px 30px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 30px;
  border: none;
  transition: all 0.3s ease;
}

.hero-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.hero-image {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.floating-cards {
  position: relative;
  width: 300px;
  height: 300px;
}

.card {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 20px;
  color: white;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  animation: float 6s ease-in-out infinite;
}

.card .el-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.card span {
  font-weight: 600;
  font-size: 1.1rem;
}

.card-1 {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: 0s;
}

.card-2 {
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  animation-delay: 2s;
}

.card-3 {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: 4s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

.features-section {
  padding: 80px 120px;
  background: white;
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  color: #2c3e50;
  margin-bottom: 60px;
  font-weight: 600;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 40px;
}

.feature-card {
  text-align: center;
  padding: 40px 30px;
  border-radius: 20px;
  background: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.feature-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.feature-icon .el-icon {
  font-size: 2rem;
}

.feature-card h3 {
  font-size: 1.5rem;
  color: #2c3e50;
  margin-bottom: 15px;
  font-weight: 600;
}

.feature-card p {
  color: #7f8c8d;
  line-height: 1.6;
  font-size: 1rem;
}

@media (max-width: 768px) {
  .hero-section {
    flex-direction: column;
    padding: 60px 40px;
    text-align: center;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
  }
  
  .hero-buttons {
    justify-content: center;
  }
  
  .floating-cards {
    margin-top: 40px;
  }
  
  .features-section {
    padding: 60px 40px;
  }
  
  .section-title {
    font-size: 2rem;
  }
}
</style> 